package com.edg.controller;

import entity.CommonResult;
import entity.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController

public class UserController {
    @Value("${service-url.nacos-user-service}")
    private String serverURL;

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("consumer/user/all")
    public CommonResult<User> all(){
        return restTemplate.getForObject(serverURL+"/user/all",CommonResult.class);
    }

    @GetMapping("consumer/user/port")
    public String port(){
        return restTemplate.getForObject(serverURL+"/user/port",String.class);
    }
}
